$caption-margin-bottom: 5px;
$p-margin-vert: 16px;

// Light
$a-color: #0000EE;
$a-color-visited: rgb(85, 26, 139);
$background-color: white;
$code-background-color: #eeeeee;
$color: black;
$target-background-color: #FFFFCC;

// Dark
$a-color: #88CCFF;
$a-color-visited: #FFAAFF;
$background-color: black;
$code-background-color: #333333;
$color: #00FF00;
$target-background-color: #442222;

@mixin hidden {
  display: none;
  // The advantage of this is that when you hover, the height can increase a bit
  // due to | separators which are very tall on certain fonts, and it is not very
  // nice to see the page move.
  //
  // However, with visibility when the screen width is small, it always takes up a newline,
  // to it is even less acceptable.
  //
  // So instead we fix the header height for now.
  //visibility: hidden;
}
@mixin visible {
  display: inline;
  //visibility: visible;
}

.cirodown {

background-color: $background-color;
color: $color;
padding-left: 0;
padding-right: 15px;
.caption-prefix {
  font-weight: bold;
}

> * {
  align-items: stretch;
  display: flex;
  > :first-child {
    // self link a
    align-items: stretch;
    display: flex;
    flex-grow: 0;
    flex-shrink: 0;
    flex-basis: 20px;
    margin-right: 10px;
    text-align: center;
    user-select: none;
    visibility: hidden;
    > :first-child {
      // span
      align-self: center;
      justify-content: center;
      display: flex;
      flex-grow: 1;
    }
  }
  &:hover > :first-child {
    background-color: $target-background-color;
    visibility: visible;
  }
  > :last-child {
    // div with actual content
    flex-grow: 1;
    > :first-child {
      margin-top: $p-margin-vert / 2;
    }
    > :last-child {
      margin-bottom: $p-margin-vert / 2;
    }
  }
}

// Hide by default, show if first child of hovered element.
.hide-hover:first-child {
}
> :hover > .hide-hover:first-child {
}
.hide-hover {
  position: absolute;
  left: 0;
}

// Highlight the element referred by the current hash
// so that the user can easily know which one it is.
:target {
  background-color: $target-background-color;
}

a {
  color: $a-color;
  text-decoration: none;
  &:hover {
    text-decoration: underline;
  }
  &:visited {
    color: $a-color-visited;
  }
}

blockquote {
  border-left: 2px solid $color;
  margin-left: 10px;
  margin-right: 0;
  padding-left: 10px;
}

code {
  background-color: $code-background-color;
}

div.p {
  margin-bottom: $p-margin-vert;
  margin-top: $p-margin-vert;
  // For the links.
}

// Figures.
figure {
  margin: 0 0 $p-margin-vert 0;
  figcaption {
    margin-top: 5px;
  }
}

h1, h2, h3, h4, h5, h6 {
  font-size: 24px;
  margin: 20px 0 8px;
  > a:first-child {
    color: $color;
    &:visited {
      color: $color;
    }
  }
  a + span {
    @include hidden;
  }
  &:hover a + span {
    @include visible;
  }
}

// Math.
.katex { font-size: 1.5em; }
.math-container {
  align-items: center;
  margin-bottom: $p-margin-vert;
  margin-top: $p-margin-vert;
  .math-caption-container {
    margin-bottom: $caption-margin-bottom;
  }
  .math-equation {
    align-items: center;
    display: flex;
    > :nth-child(1) {
      flex-grow: 9;
    }
    > :nth-child(2) {
      flex-grow: 1;
      text-align: right;
    }
  }
}

pre {
  background-color: $code-background-color;
  margin: 8px 0;
  padding: 8px 8px;
}

// Tables
.table-container {
  .table-caption-container {
    margin-bottom: $caption-margin-bottom;
  }
  table {
    $table_border: 1px solid $color;
    border: $table_border;
    border-collapse: collapse;
    th, td {
      border: $table_border;
      padding-left: 2px;
      padding-right: 2px;
    }
  }
  margin-bottom: $p-margin-vert;
}

ol, ul {
  padding-left: 30px;
}

// Table of contents.
.toc-container {
  div a + span {
    @include hidden;
  }
  div:hover a + span {
    @include visible;
  }
  ul {
    border-left: 1px solid black;
    list-style-type: none;
  }
  > ul {
    border-left: 0px solid black;
    padding-left: 0px;
  }
}

}
